#ifndef SEARCHINBLOBS_H
#define SEARCHINBLOBS_H

#include "ui_searchinblobs.h"

#include <QWidget>
#include <QSqlDatabase>
#include <QStandardItemModel>


class Searchinblobs:public QWidget,public Ui::SearchInBlobs
{
    Q_OBJECT
    public:
        Searchinblobs (QObject * parent = 0);
        ~Searchinblobs ();
        void setMedintuxUser(QString user=QString());
        void initialise();
    private slots :
        void parse();
        void addarequest();
        void deleterequest();
        void print();
    private:        
        QStringList allIdWitchContainsVariable(QString comparevariable,int row);
        QStringList allIdWhoseVariableIsInfOrSupTo(QString variable,QString comparevariable,int row,int compare);
        QHash<QString,QString> setHashIdAndNamesOfResults(QStringList resultList);
        QStringList searchInfInDocuments(QString blob,QString refDos,QString tableblobs,
                                        QString idprimkeyblob,QString idblob,QString variable,QString comparevariable, 
                                        int indexOfNumberToCompare,int compare);
        QStringList searchInTerrain(QString blob,QString refDos,QString tableblobs,QString idprimkeyblob,QString idblob,QString variable,QString comparevariable,int row,QString begin,QString end,int compare);
        QStringList searchInObservation(QString blob,QString refDos,QString tableblobs,QString idprimkeyblob,QString idblob,QString variable,QString comparevariable,int row);
        bool testofdoubleregexp(const QString & text);
        QStringList findIdOfPatientsWhoHaveConsulted(QStringList & listid);
        QString findNameFirstnameFromMedintuxGuid(const QString & refdos);
        QSqlDatabase m_db;
        QStandardItemModel * m_analyseModel;
        QStandardItemModel * m_resultsModel;
        QHash<int,QString> m_hashConditions;
        QStringList m_listOfReturnedIdWithConjunction;
        QString m_pathToPersoDatas;
        QString m_medintuxuser;
};

#endif

